<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
<script type='text/javascript' src="../js/shijian.js" charset="gb2312"></script>
<script language="javascript" src="/js/city.js" type="text/javascript" charset="gb2312"></script>
<script language="javascript" src="/member/js/catalog.js" type="text/javascript" charset="gb2312"></script>
</HEAD>
<BODY>
<?php
include('../../inc/global.inc');
include("../islogin.php");
$url=$_SERVER['HTTP_REFERER'];
?>
<?php
if($_POST['act_xg']){

$p_rs=@mysql_query("select * from city where id='$_POST[c_provinces]' and city_id=0");
$p_row=@mysql_fetch_array($p_rs);
$c_rs=@mysql_query("select * from city where id='$_POST[c_city]' and city_id>0");
$c_row=@mysql_fetch_array($c_rs);
$c_rs2=@mysql_query("select * from city where id='$_POST[c_diqu]' and city_id>0");
$c_row2=@mysql_fetch_array($c_rs2);
$m_diqu=($_POST[c_diqu])?$_POST[c_diqu]:0;

if(strlen($_POST[m_psw])==19)
	 {
	 @mysql_query("update member set m_pic='$_POST[m_pic]',m_pro='$_POST[c_provinces]',m_city='$_POST[c_city]',pro='$p_row[city_name]',city='$c_row[city_name]',diqu='$c_row2[city_name]',m_diqu='$m_diqu',m_sex='$_POST[m_sex]',m_name='$_POST[m_name]',m_email='$_POST[m_email]',m_addre='$_POST[m_addre]',m_phone='$_POST[m_phone]',m_tel='$_POST[m_tel]',m_zip='$_POST[m_zip]',m_qq='$_POST[m_qq]' where id='".$_POST['iid']."'");
	 
	 }else{
	 $psw=substr(md5($_POST[m_psw]),7,19);
	 @mysql_query("update member set m_psw='$psw',m_pic='$_POST[m_pic]',m_pro='$_POST[c_provinces]',m_city='$_POST[c_city]',pro='$p_row[city_name]',city='$c_row[city_name]',diqu='$c_row2[city_name]',m_diqu='$m_diqu',m_sex='$_POST[m_sex]',m_name='$_POST[m_name]',m_email='$_POST[m_email]',m_addre='$_POST[m_addre]',m_phone='$_POST[m_phone]',m_tel='$_POST[m_tel]',m_zip='$_POST[m_zip]',m_qq='$_POST[m_qq]' where id='".$_POST['iid']."'");
	 }
    echo "<script>alert('修改成功');location='".$_POST['urls']."'</script>";
}
?>
  <table width="780" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">会员信息&nbsp;&nbsp;<a href="javascript:history.go(-1)">Back</a></td>
    </tr>
</table>
<?php
$sql="select * from member where id=".$_GET['xg_id'];
$rs=mysql_query($sql);
$row=mysql_fetch_array($rs)
?>
<table cellspacing="1" cellpadding="0" width="780" align="center" bgcolor="#000000" border="0">
  <form action="" method="post" name="form1"  onSubmit="return checktime()">
      <tr>
        <td align="center" bgcolor="#8DA8CF" colspan="2" height="45">会员信息</td>
      </tr>
	  <tr>
        <td align="center" width="150" bgcolor="#f0f0f0" height="25">会员编号</td>
        <td width="627" bgcolor="#ffffff" style="padding-left:3px;"><?=$row['id']?></td>
      </tr>
      <tr>
        <td align="center" width="150" bgcolor="#f0f0f0" height="25">会员头像</td>
        <td width="627" bgcolor="#ffffff" style="padding-left:3px;">
		<?php if($row[m_pic]){?><img src="http://www.sandib2b.cn/upfile/<?=$row['m_pic']?>" width="120" height="120" align="absmiddle"><?php }else{?>
		<img src="/images/default_contact_photo_120.gif" align="absmiddle"><?php }?>
		<input name="m_pic" type="text" value="<?=$row['m_pic']?>" size="40"></td>
      </tr>
	  <tr>
        <td align="center" width="150" bgcolor="#f0f0f0" height="25">会员帐号<input type="hidden" name="iid" value="<?=$row['id']?>"></td>
        <td width="627" bgcolor="#ffffff" style="padding-left:3px;"><input name="m_user" type="text" value="<?=$row['m_user']?>" size="20">(禁止修改)</td>
      </tr>
	<tr>
        <td align="center" bgcolor="#f0f0f0" height="25">密码</td>
        <td bgcolor="#ffffff" style="padding-left:3px;"><input name="m_psw" type="password" id="m_psw" value="<?=$row['m_psw']?>" size="21"/></td>
      </tr>
      <tr>
	    <td height="25" align="center" bgcolor="#f0f0f0">城市选择</td>
		<td bgcolor="#FFFFFF" style="padding-left:3px;"><select name="c_provinces" onChange="changecity(document.form1.c_provinces.options[document.form1.c_provinces.selectedIndex].value)">
<option value="">--选择省份--</option>    
<?    
$rs01=@mysql_query("select * from city where city_id=0 order by order_name asc");    
while($res=@mysql_fetch_array($rs01)){    
?>    
<option value="<?=$res['id']?>" <?php if($row['m_pro']==$res['id']){echo "selected";}?>><?=$res['city_name']?></option> 
<? } ?>    
</select>     
<select name="c_city" id="c_city" onChange="changecity2(document.form1.c_city.options[document.form1.c_city.selectedIndex].value)">                    
  <option value="">--选择城市--</option>
  			<?php
			$rs2=mysql_query("select * from city where city_id=".$row['m_pro']." order by id asc");
			while($row2=mysql_fetch_array($rs2)){
			?>
			<option value="<?=$row2['id']?>" <?php if($row['m_city']==$row2['id']){echo "selected";}?>><?=$row2['city_name']?></option>
			<?php
			}?>  
</select>
	   <select name="c_diqu" id="c_diqu">
            <option value="">--选择地区--</option>
			<?php
			$rs3=mysql_query("select * from city where city_id=".$row['m_city']." order by id asc");
			while($row3=mysql_fetch_array($rs3)){
			?>
			<option value="<?=$row3['id']?>" <?php if($row['m_diqu']==$row3['id']){echo "selected";}?>><?=$row3[city_name]?></option>
			<?php
			}?> 
       </select></td>
	  </tr>
      <tr>
        <td height="25" align="center" bgcolor="#f0f0f0">联系人姓名</td>
        <td bgcolor="#ffffff" style="padding-left:3px;"><SELECT name="m_sex">
          <OPTION value="先生" <?php if($row['m_sex']=="先生"){echo "selected";}?>>先生</OPTION>
          <OPTION value="女士" <?php if($row['m_sex']=="女士"){echo "selected";}?>>女士</OPTION>
          <OPTION value="小姐" <?php if($row['m_sex']=="小姐"){echo "selected";}?>>小姐</OPTION>
        </SELECT>&nbsp;<input type="text" size="15" name="m_name" value="<?=$row['m_name']?>"/></td>
      </tr>
      <tr>
        <td height="25" align="center" bgcolor="#f0f0f0">联系人邮箱</td>
        <td bgcolor="#ffffff" style="padding-left:3px;"><input name="m_email" type="text" value="<?=$row['m_email']?>" size="35"></td>
      </tr>
      <tr>
        <td align="center" bgcolor="#f0f0f0" height="25">联系地址</td>
        <td bgcolor="#ffffff" style="padding-left:3px;"><input name="m_addre" type="text" value="<?=$row['m_addre']?>" size="50"></td>
      </tr>
	  <tr>
        <td height="25" align="center" bgcolor="#f0f0f0">联系电话</td>
        <td bgcolor="#ffffff" style="padding-left:3px;"><input name="m_tel" type="text" value="<?=$row['m_tel']?>" size="20"/></td>
      </tr>
      <tr>
        <td height="25" align="center" bgcolor="#f0f0f0">手机</td>
        <td bgcolor="#ffffff" style="padding-left:3px;"><input name="m_phone" type="text" value="<?=$row['m_phone']?>" size="20"></td>
      </tr>
	  <tr>
	    <td height="25" align="center" bgcolor="#f0f0f0">邮编</td>
	    <td bgcolor="#ffffff" style="padding-left:3px;"><input name="m_zip" type="text" size="8" maxlength="10" value="<?=$row['m_zip']?>"></td>
      </tr>
	  <tr>
	    <td height="25" align="center" bgcolor="#f0f0f0">在线联系方式</td>
	    <td bgcolor="#ffffff" style="padding-left:3px;"><input name="m_qq" type="text" size="20" value="<?=$row['m_qq']?>"></td>
      </tr>
	 <tr>
	   <td height="25" align="center" bgcolor="#f0f0f0">注册时间</td>
	   <td bgcolor="#ffffff" style="padding-left:3px;"><?=$row['m_addtime']?></td>
      </tr>
	 <tr>
	   <td height="25" align="center" bgcolor="#f0f0f0">&nbsp;</td><input type="hidden" name="urls" value="<?=$url?>">
	   <td bgcolor="#ffffff" style="padding-left:3px;"><input type="submit" value="提交">
	   <input type="hidden" name="act_xg" value="ok"></td>
      </tr>
  </form>
</table>
</BODY>
</HTML>
